/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package backupit.core;


/**
 *
 * @author dbotelho
 */
public class DefaultFileInfoComparator implements FileInfoComparator {

    private Boolean modifieable;
    
    public DefaultFileInfoComparator(){
        this(false);
    }
    
    public DefaultFileInfoComparator(Boolean modifiable){
        super();
        this.modifieable = modifiable;
    }

    public int compare(FileInfo arg0, FileInfo arg1) {
        int comp = arg0.getRelativePath().compareTo(arg1.getRelativePath());
        if (comp == 0 && this.modifieable) {
            comp=Long.valueOf(arg0.getLastTimeModified()).compareTo(Long.valueOf(arg1.getLastTimeModified()));
        }
        return comp;
    }
 
}
